<template>
    <div class="news_cell van-hairline--bottom" @click="lookDetail(info)">
        <div class="news_info">
            <div class="title">{{ info.articleName }}</div>
            <div class="image_list">
                <div class="image_cell" v-for="(citem, index) in getImages(info.photograph)" :key="index">
                    <li-image :src="citem" class="img" :is-preview="false"></li-image>
                </div>
            </div>
            <div class="time_box">
                <span>{{ info.articleAuthor }}</span>
                <span>{{ info.createdDate }}</span>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    name: 'SearchNews',
    props: {
        info: {
            type: Object,
            default: function () {
                return {}
            }
        }
    },
    data() {
        return {

        }
    },
    methods: {
        // 查看详情
        lookDetail() {
            let id = this.info.id;
            this.$router.push({
                path: `/news/detail/${id}`,
            })
        },

        // 获取图片
        getImages(str) {
            if (!str) {
                return []
            }
            let arr = str.split(',');
            if (arr.length > 3) {
                arr.length = 3;
            }
            return arr;
        },
    }
}
</script>
<style lang="less" scoped>
@import './index.less';
</style>